<?php

//we're using swift-mailer so include it here
require_once('swift-mailer/lib/swift_required.php');


//function sendmail(array(email address=>email name), string of emailSubject, string of emailMessage)
//returns number of emailMessages sent
function sendEmail($emailTo, $emailSubject, $emailMessage) {
	global $maint_log_config;
	//Create the Transport
	$transport = Swift_SmtpTransport::newInstance($maint_log_config['mail-svr'], $maint_log_config['mail-port']);

	//Create the Mailer using your created Transport
	$mailer = Swift_Mailer::newInstance($transport);

	//Create a emailMessage
	$email = Swift_Message::newInstance()
		->setSubject($emailSubject)
		->setFrom(array($maint_log_config['mail-addr'] => $maint_log_config['mail-name']))
		->setTo($emailTo)
		->setBody($emailMessage)
	;

	//Send the emailMessage
	$numSent = $mailer->send($email);
	return $numSent;
}
			
?>
